import prompt from '@system.prompt';
export default {
    data: {
        //下拉刷新标示
        fresh:false,
        courses:[{
                     id: 1, src: "/common/images/荣耀王者.png", name: "荣耀王者", book1: 304,book2:852,state:'已完结'
                 }, {
                     id: 2, src: "/common/images/荣耀巅峰.png", name: "荣耀巅峰", book1: '已读完',book2:'',state:'已完结'
                 }, {
                     id: 3, src: "/common/images/三体.png", name: "三体", book1: '未读',book2:'',state:'已完结'
                 },{
                     id: 4, src: "/common/images/荣耀王者.png", name: "天骄战绩", book1: 103,book2:1000,state:'未完结'
                 },{
                     id: 5, src: "/common/images/荣耀王者.png", name: "都市古仙医", book1: 103,book2:1000,state:'未完结'
                 }],
        backupCourses:[]
    },
    onInit(){
        this.backupCourses = JSON.parse(JSON.stringify(this.courses));
    },
    //下拉刷新
    refresh:function(e){
        prompt.showToast({
            message:'刷新中...'
        })
        var that = this;
        that.fresh =e.refreshing;
        setTimeout(function(){
            that.fresh =false;
            that.courses = that.backupCourses;
            prompt.showToast({
                message:'刷新完成！'
            })
        },2000)
    },
    scrollbottom(e){
        this.loadmore =true;
        setTimeout(()=>{
            const data = this.courses.slice(0,2);
            this.courses = this.courses.concat(data);
            this.loadmore =false;
            prompt.showToast({
                message:'加载完成！'
            })
        },2000)
    },
    clickone(name){
        prompt.showToast({
            message:name
        })
    }
}
